# range方法（函数)
# 使用for循环，求1 ~ 100的和

# 定义一个变量，用来接收1~100的和
# result = 0
# # 从1开始循环，循环100次
# for i in range(1, 101):
#     result += i
# print(f"1~100的和为{result}")

# ----------------------------------------------------------------

# 定义一个变量，用来接收1~100的偶数之和
# result = 0
# # 从1开始循环，循环100次
# for i in range(1, 101):
#     if i % 2 == 0:
#         result += i
# print(f"1~100的和为{result}")

# ----------------------------------------------------------------

# break 和 continue

# str1 = "itkuaishou"
# for i in str1:
#     if i == 's':
#         break
#     print(i)

# str1 = "itkuaishou"
# for i in str1:
#     if i == 's':
#         continue
#     print(i, end=' ')

# ----------------------------------------------------------------